package com.example.controller.siyunCouponsController;

import com.example.pojo.siyunCouponsPojo.Coupons;
import com.example.service.siyunCouponsService.CouponsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author: 杨佳欣
 * @Description: TODO
 * @DateTime: 2022/11/5 9:10
 * 优惠券列表模块
 *   对优惠券列表进行一些功能操作
 **/

@RestController
@CrossOrigin
@RequestMapping("/coupons")
public class CouponsController {
    @Autowired
    private CouponsService couponsService;

    //优惠券信息列表全查
    @RequestMapping("/getCouponslistAll")
    public List<Coupons> getCouponslistAll(){
        //System.out.println(couponsService.getCouponslistAll());
        return couponsService.getCouponslistAll();
    }
    //优惠券信息列表模糊查
    @RequestMapping("/getCouponslistFuzzyCheck")
    public List<Coupons> getCouponslistFuzzyCheck(@RequestBody Coupons coupons){
        return couponsService.getCouponslistFuzzyCheck(coupons);
    }

    //添加优惠券信息列表数据
    @RequestMapping("/addCouponslist")
    public Boolean addCouponslist(@RequestBody Coupons coupons){
        System.out.println(coupons);
        return couponsService.addCouponslist(coupons);
    }

    //根据ID删除优惠券信息列表数据
    @RequestMapping("/deleteCouponslist")
    public Boolean deleteCouponslist(Integer couponId){
        System.out.println(couponId);
        return couponsService.deleteCouponslist(couponId);
    }
}
